/*
 * 文件名：MenuDaoImpl.java
 * 版权：Copyright by will_awoke
 * 描述：
 * 修改人：will_awoke
 * 修改时间：2014-8-20
 * 跟踪单号：
 * 修改单号：
 * 修改内容：
 */

package com.qbgs.rbac.dao.impl;


import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.qbgs.rbac.dao.MenuDao;


/**
 * 
 * @author will_awoke
 * @version 2014-8-20
 * @see MenuDaoImpl
 * @since
 */
@Repository
public class MenuDaoImpl implements MenuDao
{

    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public List<Map<String, Object>> queryAllMenus()
    {
        String sql = " select menu_id,parent_id,menu_code,menu_bar,menu_url from t_sys_menu order by menu_id ";
        return jdbcTemplate.queryForList(sql);
    }

    @Override
    public List<Map<String, Object>> queryMenuById(String menuId)
    {
        String sql = " select menu_id,parent_id,menu_code,menu_bar,menu_url from t_sys_menu where menu_id=? ";
        Object[] params = {menuId};

        return jdbcTemplate.queryForList(sql, params);
    }

}
